package com.attilax.io;

import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileExistsException;
import org.apache.commons.io.FileUtils;
import org.junit.Test;

import com.attilax.util.codelibutil;

public class DirServiceTest {

	@Test
	public void testMoveDir2destxx() {
		fail("Not yet implemented");
	}
	
	
	@Test 
	public   void test_forcedele() throws IOException{
		
		FileUtils.deleteDirectory( new File("C:\\codelibcaptch\\FulltxtLucenePrj") );
	//	codelibutil.moveDirSubEmptyDir("C:\\codelibcaptch\\FulltxtLucenePrj");
		System.out.println(  new File("C:\\codelibcaptch\\FulltxtLucenePrj").exists() );
	}
	
	
	
	@Test 
	public   void moveEmptyDir(){
		
		
		codelibutil.moveDirSubEmptyDir("C:\\codelibcaptch", "C:\\codelibcaptch_emptydir2");
	}

	@Test( )
	public   void test_moveDir2dest( ) throws IOException {
		File f=new File("C:\\codelibcaptch\\aaa\\.settings");
	//	FileUtils.moveDirectory(f, new File("C:\\codelibcaptch_emptydir\\bin"));
		try {
			FileUtils.moveDirectoryToDirectory(f, new File("C:\\codelibcaptch_emptydir"), true);
		} catch (FileExistsException   e) {
			FileUtils.deleteDirectory(f);
		}
	
		System.out.println("f");
	}

}
